﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StuManager
{
    public partial class ScoreFrm : Form
    {
        private String stuNo;
        private String courseNo;
        private Context.MyContext ctx = new Context.MyContext();

        public ScoreFrm(String _stuNo, String _courseNo)
        {
            this.stuNo = _stuNo;
            this.courseNo = _courseNo;

            InitializeComponent();//初始化界面控件
        }

        //所有界面初始化完成后触发执行
        private void ScoreFrm_Load(object sender, EventArgs e)
        {
            lbStuNo.Text = stuNo;
            lbCourseNo.Text = courseNo;

            var sc = ctx.Scs.Where(s => s.StuNo == stuNo && s.CourseNo == courseNo).Include(sc => sc.StudentDetail).Include(sc => sc.CourseDetail).ToList()[0];

            lbStuName.Text = sc.StudentDetail.StuName;
            lbCourseName.Text = sc.CourseDetail.CourseName;
            txtResult.Text = sc.Result.ToString();
        }
    }
}
